<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>

<html lang="en">
<head>
<%@ include file="/common/common-css.jsp"%>
<link rel="stylesheet" type="text/css" href="${ctx}/css/wangEditor-1.3.11.css" />
<style>
   .load_bg{background:#000;opacity:0.1;left:0px;top:0px;position:fixed;height:100%;width:100%;overflow:hidden;z-index:10000;}
   .load_img{left:50%;top:180px;position:fixed;height:50px;overflow:hidden;z-index:20000;}
   .setnone{
	   display: none;
   }
   .widget-color-blue{
	   margin-top: 20px;
   }
   .autoTxtCount {
	   position: relative;
   }
   .autoTxtCount .tips {
	   position: absolute;
	   right: 5px;
	   bottom: 7px;
	   z-index: 99;
   }
   .wangEditor-container .wangEditor-textarea p{
	   margin: 0; 
   }
   .view{
	   border: 1px solid #cccccc;
   }
   .no-border{
	   border: none;
   }
   .img-box{
	  border: 1px solid #cccccc;
	  display: inline-block;
	  position: relative;
      padding: 20px 2px 2px 2px;	
      margin: 10px 5px 10px 5px;	  
   }
   .img-box img{
	  height: 180px;
   }
   .img-box i{
	  position: absolute;
	  top: 3px;
      right: 3px;
	  cursor: pointer;
      font-size: 1.2em;	  
   }
   .home_image-view{
	   max-width: 90%;
   }
   .mall-alert{
	  position: fixed;
	  z-index: 300000;
	  width: 50%;
	  left: 25%;
	  top: 30%;
	  display: none;
   }
   .modal{
	   top: 30%;
   }
   .checkbox label{
	   margin-left: 20px;
   }
   .checkbox label:nth-child(1){
	   margin-left: 0;
   }
   @media only screen and (min-width: 1280px){
	  .view{
		  margin-left: -16px;
	  }
   }
</style>
</head>
<body class="no-skin">
   <div  class="load_bg" style="display:none;" ></div>
   <img src="http://img.xmiles.cn/commentloading.gif" class="load_img" style="display:none"/>
   <div class="page-content">
       <div class="page-content-area">
	       <div class="row">
			   <div class="col-xs-12 col-sm-12 widget-container-col">
					<div class="widget-box widget-color-blue">
					   <div class="widget-body">
							<div class="widget-main">
								<form name="mallProduct" method="post" enctype="multipart/form-data" action="">
									 <div class="row">
									  	<div class="form-group col-xs-12 col-sm-4 col-md-3 col-lg-3">
											<label class="col-sm-4 control-label"  style="text-align:right"  for="isprize">回拉用户类型:</label>
											<div class="col-sm-8" style="padding-left:0;">
												<input id="day_mode" name="day_mode" type="text" value="${paramsMap.model.day_mode }" />
												<input name="id" type="hidden" value="${paramsMap.model.id }"/>
											</div>
										</div>
									  </div>
									  <div class="row">
									       <div class="form-group col-sm-1 col-xs-3 text-right">
											<label class="control-label"  for="recommend">发送内容</label>
										 </div>
										 <div class="form-group col-sm-11 col-xs-12 text-right" style="padding-left:12px;">
											<div class="input-group col-sm-12 col-xs-12 text-left">
												<input class="form-control" name="content" id='content' type="text" placeholder="请输入发送内容" value="${paramsMap.model.content }" />
											</div>
										 </div>	
									  </div>
									  <div class="row">
										  <div class="form-group col-sm-1 col-xs-3 text-right">
											<label class="control-label"  for="recommend">备注</label>
										 </div>
										 <div class="form-group col-sm-11 col-xs-12 text-right" style="padding-left:12px;">
											<div class="input-group col-sm-12 col-xs-12 text-left">
												<input class="form-control" name="remark" id='remark' type="text" placeholder="请输入备注" value="${paramsMap.model.remark }" />
											</div>
										 </div>	
									  </div>	
									  <div class="row">
										 <div class="form-group col-sm-1 col-xs-3 text-right">
											<label class="control-label"  for="recommend">提示邮箱</label>
										 </div>
										 <div class="form-group col-sm-11 col-xs-12 text-right" style="padding-left:12px;">
											<div class="input-group col-sm-12 col-xs-12 text-left">
												<input class="form-control" name="mail" id='mail' type="email" placeholder="请输入提示邮箱" value="${paramsMap.model.mail }" />
											</div>
										 </div>
									  </div>
									 
									<div class="form-group col-xs-12 col-sm-4 col-md-3 col-lg-3">
											<label class="col-sm-4 control-label"  style="text-align:right"  for="isprize">产品:</label>
											<div class="col-sm-8" style="padding-left:0;">
												<select class="form-control" name="prd_id" id="prd_id">
													<option value="8000">菠萝贷主包</option>
													<option value="8001">极速借钱</option>
													<option value="8002">菠萝贷iOS</option>
												</select>
											</div>
										</div>
								
									  <div class="row">  
										  <div class="col-md-12 center">
												<button type="button" class="btn btn-lg btn-success no-border" id="save" >
													<i class="ace-icon fa fa-floppy-o"></i> 确认
												</button>
												&nbsp;&nbsp;&nbsp;
												<button class="btn btn-grey  no-border" type="reset">
													<i class="ace-icon fa fa-undo icon-on-right bigger-110"></i>
													重置
												</button>
										  </div>
									  </div>
								</form>
							</div>
						</div>	
					</div>
				</div>	
             </div>				
		</div>
   </div>	
   

<!--警告-->
<div class="alert alert-danger alert-dismissible mall-alert" role="alert">
  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  <b>注意:</b> &nbsp; <span id="alert-text"></span>
</div>


</body>
<%@ include file="/common/common-js.jsp" %>
<script type="text/javascript" src="${ctx}/ace/js/maxlength.js"></script>
<script type="text/javascript" src="${ctx}/js/wangEditor-1.3.11.min.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery.form.js"></script>
<script type="text/javascript">



jQuery(function($) {
	
	var day_mode = $("#day_mode").val();
	if (day_mode != null && day_mode != '') {
		var prd_id = '${paramsMap.model.prd_id}';
		$("#prd_id option[value="+prd_id+"]").attr("selected", true);
	} 
	
	//确认保存按钮
	$('#save').on('click', function(){
		if($('#content').val() == '' || $('#content').val() == null){
			toast('请填写发送内容', '#content');
			return false;
		}
		if($('#remark').val() == '' || $('#remark').val() == null){
			toast('请填写备注', '#remark');
			return false;
		}
		if($('#mail').val() == '' || $('#mail').val() == null){
			toast('请填写邮箱', '#mail');
			return false;
		}
		$(this).attr('disabled',false);
		saveForm();
	});
});

//表单异步提交
function saveForm(){
	var saveUrl=ctx + '/pullBackMessage/sendPullBackMessage.action';
	var options = { 
			url :saveUrl,
			type : "POST",
			dataType : "json",
			beforeSend: function(){
				$(".load_bg,.load_img").show();
			},
			success : function(data) {
				var message=data.message;
				alert(message);
			},
			error: function(XMLHttpRequest, textStatus, errorThrown){
			    alert(textStatus);
			    console.log(XMLHttpRequest, textStatus, errorThrown);
			},
	        complete : function(){
				$(".load_bg,.load_img").hide();
				parent.parent['__extdialog_active'].dialog('close');
			}
		};
    $('form[name="mallProduct"]').ajaxSubmit(options);
};

</script>
</html>